package com.qf.medical.service.impl; /*
            
            " * ░░░░░░░░░░░░░░░░░░░░░░░░▄░░\n" +
            " * ░░░░░░░░░▐█░░░░░░░░░░░▄▀▒▌░\n" +
            " * ░░░░░░░░▐▀▒█░░░░░░░░▄▀▒▒▒▐\n" +
            " * ░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐\n" +
            " * ░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐\n" +
            " * ░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌\n" +
            " * ░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒\n" +
            " * ░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐\n" +
            " * ░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄\n" +
            " * ░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒\n" +
            " * ▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒\n" +
            " * 单身狗就这样默默地看着你，一句话也不说。\n" +
            " */

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.medical.mapper.DoctorMapper;
import com.qf.medical.service.DoctorService;
import com.qf.medical.vo.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @EXPLAIN:
 * @author: 宋金锋
 * @Email: 2697586849@qq.com
 */
@Service
public class DoctorServiceImpl implements DoctorService {
    @Autowired
    private DoctorMapper doctorMapper;
    @Override
    public PageBean selectWhere(String name, int page, int limit) {
        if (!StringUtils.hasLength(name)) {
            name = null;
        } else {
            name = "%" + name + "%";
        }
        PageHelper.startPage(page, limit);
        PageInfo info = new PageInfo(doctorMapper.selectWhere(name));
        return PageBean.bean(info.getTotal(), info.getList());
    }
}
